All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH] Teach 'git apply' to look at $GIT_DIR/config
Date: Mon, 19 Feb 2007 15:37:35 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0702191527320.20368@woody.linux-foundation.org> (raw)
In-Reply-To: <7vodnp68p8.fsf@assigned-by-dhcp.cox.net>



On Mon, 19 Feb 2007, Junio C Hamano wrote:
> > ...
> > git-apply has much saner defaults (it defaults to something pretty safe, 
> > and you can then make it less safe if the patch doesn't apply).
> 
> All true.

One thing I forgot to mention: "git apply" doesn't apply *anything* unless 
everything applies cleanly. In contrast, when "patch" fails in the middle, 
it will have done part of the job, and then leaves a reject file. I much 
prefer the "everything or nothing" approach of git-apply (again, obviously 
with "--reject" you can make it work the bad old way too).

> By the way, do you want to veto a related change that makes
> git-apply behave consistently between:
> 
> 	$ cd sub/directory
>         $ git apply patch.file
> 
> and
> 
> 	$ cd sub/directory
>         $ git apply --index patch.file
> 
> The issue is, that "patch.file" (typically) starts with:
> 
> 	diff a/sub/directory/Makefile b/sub/directory/Makefile
> 	--- a/sub/directory/Makefile
> 	+++ b/sub/directory/Makefile
> 
> and the form without --index would say "What are you talking
> about? I do not see sub/directory/Makefile".
> 
> I consider this is a bugfix, but it does change the behaviour,
> so I am a bit worried about possible fallout.

Ahh.. I'm not going to veto it, although I have to admit that I don't know 
what the "right answer" is, or if a "right answer" really exists.

I _think_ that the right answer is to (a) yes, make it be consistent, but 
(b) _not_ make it be the way we do "--index" now.

Right now, when we see "--index", we do the "setup_git_directory()" and 
the git_config() stuff - which is (I think) something we should always do, 
but then we do *not* prefix the patch itself with the prefix we got. And I 
think that's wrong. I think we should always do the "-p1" behaviour from 
where we started.

Then, if somebody is in a sub/directory/, maybe they need to add a "-p3" 
to indicate that, but at least that's better than having a patch that just 
says "Makefile", and applying the patch to the *wrong* "Makefile" 
(top-level one, rather than the one you were in).

Hmm?

		Linus

  reply	other threads:[~2007-02-19 23:37 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-17 20:37 [PATCH] Teach core.autocrlf to 'git apply' Junio C Hamano
2007-02-17 21:12 ` [PATCH] Teach 'git apply' to look at $GIT_DIR/config Junio C Hamano
2007-02-17 23:26   ` Jeff King
2007-02-17 23:31     ` Junio C Hamano
2007-02-17 23:32       ` Jeff King
2007-02-19 22:57         ` Linus Torvalds
2007-02-19 23:04           ` Shawn O. Pearce
2007-02-19 23:14           ` Junio C Hamano
2007-02-19 23:37             ` Linus Torvalds [this message]
2007-02-19 23:57               ` Junio C Hamano
2007-02-20  0:11                 ` Linus Torvalds
2007-02-20  0:35                   ` Junio C Hamano
2007-02-20  0:53                     ` Johannes Schindelin
2007-02-20  1:29                       ` Junio C Hamano
2007-02-20  1:43                         ` Johannes Schindelin
2007-02-20  1:57                     ` [PATCH] git-apply: require -p<n> when working in a subdirectory Junio C Hamano
2007-02-20  2:33                       ` [PATCH] apply: fix memory leak in prefix_one() Johannes Schindelin
2007-02-20  2:39                         ` Junio C Hamano
2007-02-20  2:45                           ` Johannes Schindelin
2007-02-20  1:58                     ` [PATCH] git-apply: do not lose cwd when run from a subdirectory Junio C Hamano
2007-02-20  1:28                   ` [PATCH] Teach 'git apply' to look at $GIT_DIR/config Junio C Hamano
2007-02-20  1:38                     ` Linus Torvalds
2007-02-21  5:39                   ` Daniel Barkalow
2007-02-21 11:22                     ` Junio C Hamano
2007-02-21 17:00                       ` Daniel Barkalow
2007-02-21 16:44                     ` Linus Torvalds
2007-02-21 19:35                       ` Junio C Hamano
2007-02-21 22:31                         ` [PATCH] git-apply: notice "diff --git" patch again Junio C Hamano
2007-02-22  0:24                           ` [PATCH] git-apply: guess correct -p<n> value for non-git patches Junio C Hamano
2007-02-20  0:16                 ` [PATCH] Teach 'git apply' to look at $GIT_DIR/config Johannes Schindelin
2007-02-20  0:36                 ` Simon 'corecode' Schubert
2007-02-18  0:08       ` Johannes Schindelin
2007-02-18  0:28         ` Junio C Hamano
2007-02-18  0:40           ` Johannes Schindelin
2007-02-18  1:03             ` Junio C Hamano
2007-02-18  1:15               ` Johannes Schindelin
2007-02-18  1:47                 ` Junio C Hamano
2007-02-18  2:00                   ` Johannes Schindelin
2007-02-18  2:15                     ` Junio C Hamano
2007-02-18 11:40                       ` Johannes Schindelin
2007-02-18  1:48               ` Jakub Narebski
2007-02-18  0:06     ` Johannes Schindelin
2007-02-18  0:31       ` Junio C Hamano
2007-02-18  0:53         ` Johannes Schindelin
2007-02-18  1:20           ` Junio C Hamano
2007-02-18  1:29             ` Johannes Schindelin
2007-02-18  1:48               ` Junio C Hamano
2007-02-18  2:01                 ` Johannes Schindelin
2007-02-18  2:10                   ` Junio C Hamano

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=Pine.LNX.4.64.0702191527320.20368@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=peff@peff.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.