summaryrefslogtreecommitdiff
path: root/git-merge-one-file.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-19 19:50:44 -0800
committerJunio C Hamano <junkio@cox.net>2005-11-19 19:50:44 -0800
commit397c76697f898e0341699fba8ef783f3342329c7 (patch)
treeea62f7003bb2769fa23d5ca371d84cee9d2ec46f /git-merge-one-file.sh
parent22a06b3c474d256e945dbc0d2a830c3f467288b5 (diff)
downloadgit-397c76697f898e0341699fba8ef783f3342329c7.tar.gz
merge-one-file: remove empty directories
When the last file in a directory is removed as the result of a merge, try to rmdir the now-empty directory. [jc: We probably could use "rmdir -p", but for now we do that by hand for portability.] Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-merge-one-file.sh')
-rwxr-xr-xgit-merge-one-file.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index b08597de29..b285990fb2 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -25,7 +25,12 @@ case "${1:-.}${2:-.}${3:-.}" in
echo "Removing $4"
fi
if test -f "$4"; then
- rm -f -- "$4"
+ rm -f -- "$4" &&
+ dn="$4" &&
+ while dn=$(expr "$dn" : '\(.*\)/') && rmdir "$dn" 2>/dev/null
+ do
+ :;
+ done
fi &&
exec git-update-index --remove -- "$4"
;;