[PATCH] Improved example "To move the whole tree into a subdirectory...".

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously this example would fail if the history contained any empty
commit, because the index would not change, and the mv would fail with:

mv: cannot stat <redacted>/index.new': No such file or directory

The updated example checks whether the index file has been created
before attempting the mv.  The empty commit is retained.

See
http://stackoverflow.com/questions/7798142/error-combining-git-repositories-into-subdirs
for an example and explanation.

Signed-off-by: Brett Randall <javabrett@xxxxxxxxx>
---
 Documentation/git-filter-branch.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/git-filter-branch.txt
b/Documentation/git-filter-branch.txt
index 73fd9e8..0b9e690 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -385,7 +385,7 @@ git filter-branch --index-filter \
        'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
                GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
                        git update-index --index-info &&
-        mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD
+        if [ -f "$GIT_INDEX_FILE.new" ]; then mv
"$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"; fi' HEAD
 ---------------------------------------------------------------


-- 
2.3.5
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]