All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Olivier Marin <dkr+ml.git@free.fr>
Cc: "git list" <git@vger.kernel.org>,
	"Luciano Rocha" <luciano@eurotux.com>,
	pascal@obry.net, "Pierre Habouzit" <madcoder@debian.org>,
	"Kristian Høgsberg" <krh@redhat.com>
Subject: Re: [PATCH] files given on the command line are relative to $cwd
Date: Wed, 06 Aug 2008 13:59:25 -0700	[thread overview]
Message-ID: <7vd4kln9le.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 7vtzdxnbgk.fsf@gitster.siamese.dyndns.org

Junio C Hamano <gitster@pobox.com> writes:

> Olivier Marin <dkr+ml.git@free.fr> writes:
>
>> Junio C Hamano a écrit :
>>>  
>>>  static int parse_and_validate_options(int argc, const char *argv[],
>>> -				      const char * const usage[])
>>> +				      const char * const usage[],
>>> +				      const char *prefix)
>>>  {
>>>  	int f = 0;
>>>  
>>>  	argc = parse_options(argc, argv, builtin_commit_options, usage, 0);
>>> +	logfile = parse_options_fix_filename(prefix, logfile);
>>
>> It breaks the "git commit -F -" case, no?
>
> Does it?  Ah, yeah, t7500 #15 does not go down to a subdirectory.

Ok, this squashed in on top of the previous one should cover the case.

Thanks for saving me in time from a major embarrassment.  I already tagged
1.5.6.5 with the botched one but haven't pushed it out, so I can safely
rewind.

---

 parse-options.c   |    2 +-
 t/t7500-commit.sh |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/parse-options.c b/parse-options.c
index d771bf4..12c8822 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -432,7 +432,7 @@ int parse_opt_approxidate_cb(const struct option *opt, const char *arg,
  */
 extern const char *parse_options_fix_filename(const char *prefix, const char *file)
 {
-	if (!file || !prefix || is_absolute_path(file))
+	if (!file || !prefix || is_absolute_path(file) || !strcmp("-", file))
 		return file;
 	return prefix_filename(prefix, strlen(prefix), file);
 }
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index 2ab791b..823256a 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -159,4 +159,12 @@ test_expect_success 'commit message from file (2)' '
 	commit_msg_is "Log in sub directory"
 '
 
+test_expect_success 'commit message from stdin' '
+	(
+		cd subdir &&
+		echo "Log with foo word" | git commit --allow-empty -F -
+	) &&
+	commit_msg_is "Log with foo word"
+'
+
 test_done

  reply	other threads:[~2008-08-06 21:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06 10:30 something fishy with Git commit and log from file Pascal Obry
2008-08-06 10:44 ` Luciano Rocha
2008-08-06 11:01   ` Pascal Obry
2008-08-06 15:38     ` Junio C Hamano
2008-08-06 16:28       ` Pascal Obry
2008-08-06 16:50         ` Junio C Hamano
2008-08-06 17:08           ` Pascal Obry
2008-08-06 18:43           ` [PATCH] files given on the command line are relative to $cwd Junio C Hamano
2008-08-06 20:14             ` Olivier Marin
2008-08-06 20:19               ` Junio C Hamano
2008-08-06 20:59                 ` Junio C Hamano [this message]
2008-08-06 20:40             ` Pierre Habouzit
2008-08-07  8:45             ` Samuel Tardieu
2008-08-07  9:03               ` Luciano Rocha
2008-08-07  9:47                 ` 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=7vd4kln9le.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=dkr+ml.git@free.fr \
    --cc=git@vger.kernel.org \
    --cc=krh@redhat.com \
    --cc=luciano@eurotux.com \
    --cc=madcoder@debian.org \
    --cc=pascal@obry.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.