Re: git add --patch newfile doesn't add newfile to cache ?

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

 



On Wed, Oct 22, 2008 at 03:12:32PM +0200, Marc Weber wrote:

> >  sub patch_update_cmd {
> > +	my @new = list_untracked();
> > +	if (@new) {
> > +		system(qw(git add -N), @new)
> > +			and die "git add reported failure";
> > +	}
> > +
>  
> 
> I've tried the patch. However I'm not fully satisified.
> I often use --patch to have another second look at each change to be
> committed. Your patch adds new files to the cache silently without
> giving the user the change to omit or edit the patch. But exatly that's
> the reason I'm using --patch. So maybe I can work on this in some days..
> Maybe I've also injected those lines into the wrong git version 
> (1.6.0.2.GIT)

Yes, you need to use the current 'master' branch for the "-N" feature.
The point of "-N" is to say "this is a file I want to track, but don't
add any contents yet." So it does your part 1:

>       1) when using git add --patch untracked-file the user should be
>          given the default patch view (only containing + lines)
>          so that he can use edit to only commit parts of the file in the
>          usual way. (I guess this is similar to having used git add -N
>          before, I haven't tried yet)

But not your part 2:

>       2) if he wants to skip the entire patch / file nothing should be
>          added to the index.

If you add _no_ contents, you still end up with the "this is a file I
want to track" part, but with no contents. And I agree it should stage
nothing, which is why this is an unsatisfactory solution (and why I
didn't clean up the patch and send it to Junio for inclusion).

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