From: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: git-mv: keep git index consistent with file system on failed rename
Date: Sun, 27 Nov 2005 22:04:14 +0100 [thread overview]
Message-ID: <200511272204.14835.Josef.Weidendorfer@gmx.de> (raw)
When doing multiple renames, and a rename in the middle fails,
git-mv did not store the successful renames in the git index;
this is fixed by delaying the error message on a failed rename
to after the git updating.
Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
---
This is actually independent from the just sent patch, but
the context lines shows it applied...
git-mv.perl | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
applies-to: 8acd56ea24d565996dc4618f7d7e4fa152d8623c
81f4a3e528094e5e2b0221fd6e76edd205c8e56d
diff --git a/git-mv.perl b/git-mv.perl
index 990bec5..ac19876 100755
--- a/git-mv.perl
+++ b/git-mv.perl
@@ -142,14 +142,17 @@ while(scalar @srcArgs > 0) {
# Final pass: rename/move
my (@deletedfiles,@addedfiles,@changedfiles);
+$bad = "";
while(scalar @srcs > 0) {
$src = shift @srcs;
$dst = shift @dsts;
if ($opt_n || $opt_v) { print "Renaming $src to $dst\n"; }
if (!$opt_n) {
- rename($src,$dst)
- or die "rename failed: $!";
+ if (!rename($src,$dst)) {
+ $bad = "renaming '$src' failed: $!";
+ last;
+ }
}
$safesrc = quotemeta($src);
@@ -209,3 +212,8 @@ else {
close(H);
}
}
+
+if ($bad ne "") {
+ print "Error: $bad\n";
+ exit(1);
+}
---
0.99.9.GIT
reply other threads:[~2005-11-27 21:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200511272204.14835.Josef.Weidendorfer@gmx.de \
--to=josef.weidendorfer@gmx.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox