From: Thomas Rast <trast@inf.ethz.ch>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"René Scharfe" <rene.scharfe@lsrfire.ath.cx>,
"Ramkumar Ramachandra" <artagnon@gmail.com>,
"Stephen Boyd" <sboyd@codeaurora.org>,
"Felipe Contreras" <felipe.contreras@gmail.com>
Subject: [PATCH] Test 'commit --only' after 'checkout --orphan'
Date: Sat, 1 Jun 2013 13:02:00 +0200 [thread overview]
Message-ID: <78176f4fca45213961f0e4d15ac72012d6a0a10b.1370084247.git.trast@inf.ethz.ch> (raw)
In-Reply-To: <CACsJy8A6Hq_LEqAxUTLKP9-TA6aTq+91Wx2vYLhSuMSmRvpYiA@mail.gmail.com>
There are some index handling subtleties in 'commit --only' that are
best tested when we have an existing index, but an unborn or empty
HEAD. These circumstances are easily produced by 'checkout --orphan',
but we did not previously have a test for it.
The main expected failure mode would be: erroneously loading the
existing index contents when building the temporary index that is used
for --only. Cf.
http://article.gmane.org/gmane.comp.version-control.git/225969
and subsequent discussion.
Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
---
t/t7501-commit.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 195e747..99ce36f 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -524,4 +524,17 @@ test_expect_success 'commit a file whose name is a dash' '
test_i18ngrep " changed, 5 insertions" output
'
+test_expect_success '--only works on to-be-born branch' '
+ # This test relies on having something in the index, as it
+ # would not otherwise actually prove much. So check this.
+ test -n "$(git ls-files)" &&
+ git checkout --orphan orphan &&
+ echo foo >newfile &&
+ git add newfile &&
+ git commit --only newfile -m"--only on unborn branch" &&
+ echo newfile >expected &&
+ git ls-tree -r --name-only HEAD >actual &&
+ test_cmp expected actual
+'
+
test_done
--
1.8.3.509.g0de0faa
next prev parent reply other threads:[~2013-06-01 11:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 11:58 [PATCH 0/4] cherry-pick: fix memory leaks Felipe Contreras
2013-05-30 11:58 ` [PATCH 1/4] commit: reload cache properly Felipe Contreras
2013-05-30 12:17 ` Thomas Rast
2013-05-30 12:35 ` Felipe Contreras
2013-05-30 12:58 ` Thomas Rast
2013-05-30 13:07 ` Felipe Contreras
2013-06-01 9:09 ` Duy Nguyen
2013-06-01 11:02 ` Thomas Rast [this message]
2013-05-30 13:08 ` Duy Nguyen
2013-05-30 11:58 ` [PATCH 2/4] read-cache: plug small memory leak Felipe Contreras
2013-05-30 11:58 ` [PATCH 3/4] unpack-trees: plug a " Felipe Contreras
2013-06-02 19:33 ` Junio C Hamano
2013-06-02 19:51 ` Felipe Contreras
2013-06-02 22:17 ` Junio C Hamano
2013-06-02 22:45 ` Felipe Contreras
2013-05-30 11:58 ` [PATCH 4/4] unpack-trees: free created cache entries Felipe Contreras
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=78176f4fca45213961f0e4d15ac72012d6a0a10b.1370084247.git.trast@inf.ethz.ch \
--to=trast@inf.ethz.ch \
--cc=artagnon@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=rene.scharfe@lsrfire.ath.cx \
--cc=sboyd@codeaurora.org \
/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;
as well as URLs for NNTP newsgroup(s).