99# ------------------------------------------------------------------------------
1010# @TODO: Add yes mode (-y / --yes) to run without questions
1111# ------------------------------------------------------------------------------
12+ # @FIXME: Merge commit happens from the wrong author
13+ # ------------------------------------------------------------------------------
14+ # @FIXME: The cleanup gives errors if cleanup is run before/without the split being run
15+ # ------------------------------------------------------------------------------
1216# @FIXME: Add "aggressive" mode that creates a commit on the source branch (?before/after? merge)
1317# of the source file with all of the lines from the split file removed.
1418# - Using grep?
3236# # things to be after the file has been split.
3337# # - <target-path> is the directory where the split files should be committed to
3438# # - <split-strategy> is the strategy that should be applied to the source-file
35- # # Can be one of DELETE | KEEP | MOVE
39+ # # Can be one of DELETE | MOVE
3640# #
3741# / Usually when you want to split a file into several files under git, you would
3842# / loose the git history of this file. Often this is not desirable. The goal of
@@ -251,9 +255,9 @@ handleParams() {
251255 readonly g_sSplitDirectory=" ${sSplitDirectory} "
252256 fi
253257
254- if [[ " ${g_sStrategy} " != ' DELETE' && " ${g_sStrategy} " != ' KEEP ' && " ${g_sStrategy} " != ' MOVE' ]]; then
258+ if [[ " ${g_sStrategy} " != ' DELETE' && " ${g_sStrategy} " != ' MOVE' ]]; then
255259 g_iExitCode=71
256- error " The given split strategy '${g_sStrategy} ' is not one of supported DELETE | KEEP | MOVE"
260+ error " The given split strategy '${g_sStrategy} ' is not one of supported DELETE | MOVE"
257261 fi
258262 fi
259263
@@ -413,11 +417,11 @@ createSubBranches() {
413417
414418 printTopic ' Creating sub-branches'
415419 for sFile in " ${g_sSplitDirectory} /" * ; do
416- # if [[ "${sFile}" = "${g_sSourceFileName}" ]];then
417- # printStatus "Skipping branch for source file '${g_sSourceFileName}'"
418- # else
420+ # if [[ "${sFile}" = "${g_sSourceFileName}" && "${g_sStrategy}" != "MOVE " ]];then
421+ # printStatus "Skipping branch for source file '${g_sSourceFileName}'"
422+ # else
419423 createSplitBranch " ${sFile} "
420- # fi
424+ # fi
421425 done
422426}
423427
@@ -541,20 +545,20 @@ run() {
541545 printTopic " Running split process for source file '${g_sSourceFileName} '"
542546 checkoutSourceBranch
543547
544- if [[ ${g_sStrategy} = ' KEEP' ]]; then
545- echo ' @CHECKME: Nothing to do?'
546- elif [[ ${g_sStrategy} = ' MOVE' ]]; then
548+ if [[ ${g_sStrategy} = ' MOVE' ]]; then
547549 commitFileContent " ${g_sSourceFileName} "
550+ mergeSplitBranch " ${g_sSourceFileName} "
548551 elif [[ ${g_sStrategy} = ' DELETE' ]]; then
549- git rm " ${g_sSourceFilePath} "
550- commit " Removes '${g_sSourceFilePath} ' file that has been split."
552+ printStatus ' Nothing to do for DELETE as file has already been renamed.'
553+ # git rm "${g_sSourceFilePath}"
554+ # commit "Removes '${g_sSourceFilePath}' file that has been split."
551555 else
552556 error " Unsupported merge strategy '${g_sStrategy} '" 70
553557 fi
554- mergeSplitBranch " ${g_sSourceFileName} "
555558
556559 printTopic " Merging source branch '${g_sSourceBranch} ' into the root branch '${g_sRootBranch} '"
557560 checkoutRootBranch
561+
558562 git merge --no-ff --no-edit " ${g_sSourceBranch} "
559563 else
560564 printMessage ' Aborting.'
@@ -572,7 +576,6 @@ finish() {
572576 if [[ ${g_iExitCode} -eq 65 ]]; then
573577 shortUsage
574578 echo ' Call --help for more details'
575-
576579 fi
577580 fi
578581
@@ -592,7 +595,7 @@ finish() {
592595 exit ${g_iExitCode}
593596}
594597
595- function debugTrapMessage {
598+ debugTrapMessage () {
596599 printDebug " ${g_sColorDim} [${1} :${2} ] ${3}${g_sColorRestore} "
597600}
598601
0 commit comments