Re: [PATCH 2/4] Teach git-add--interactive to accept a file path to patch

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

 



El 21/11/2007, a las 16:21, Jeff King escribió:

On Wed, Nov 21, 2007 at 01:36:39PM +0100, Wincent Colaiuta wrote:

+if ($#ARGV == 0) {
+	patch_update_file($ARGV[0]);
+}

Why only one file? How about something like this instead:

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index fb1e92a..8036c95 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -804,5 +804,8 @@ sub main_loop {
}

refresh();
+foreach my $file (@ARGV) {
+	patch_update_file($file);
+}
status_cmd();
main_loop();

Yes, that makes sense. I wasn't sure how to handle multiple files, but I guess just looping through them is fine.

On top of that, it would be great to be able to do something like

 git-add -i *.c

and just get prompted for changed files (right now, you only get
prompted for changed files, but unchanged files seem to print a spurious
newline).

That spurious newline comes from the last line of the patch_update_file function (previously named patch_update_cmd):

	print "\n";

The solution will be to do an early return, printing nothing for those unchanged files (and same thing for untracked files). Will look into it.

And at any rate, this would require fixing 3/4 to handle the multiple
files from git-add.

What do you think?

Should have some time later this evening or tomorrow to incorporate your suggestions.

Cheers,
Wincent


-
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]

  Powered by Linux