From: Jasmin Oster <JOster@anexia.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: git-merge: --no-commit is not respected on a fresh repository
Date: Wed, 3 Apr 2024 13:26:53 +0000 [thread overview]
Message-ID: <22efe19e-de44-4b6d-8e8b-57e2bddb321e@anexia.com> (raw)
## What did you do before the bug happened? (Steps to reproduce your issue)
When trying to perform a subtree merge, especially following the blog
post on https://nuclearsquid.com/writings/subtree-merging-and-you/,
I noticed that Git does not respect the --no-commit option if the
repository does not have a history.
1. Create a new repository: $ git init
2. Add a remote: $ git remote add foo ../<path-to-another-repo>
3. Fetch everything: $ git fetch --all
4. Initiate a subtree merge: $ git merge -s our --no-commit foo/main
## What did you expect to happen? (Expected behavior)
The repository should've been in the "merging" state, in order to
rewrite the paths using:
$ git read-tree --prefix=/project/ -u foo/main
It's only a minor annoyance that can be fixed by adding an empty commit
in advance of performing the merge, yet it took me some minutes to
figure out why Git does not behave as intended.
## What happened instead? (Actual behavior)
A merge commit was created.
## What's different between what you expected and what actually happened?
Said merge commit, even though the `--no-commit` option was set.
[System Info]
git version:
git version 2.44.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.7.10-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Mar 18
18:56:52 UTC 2024 x86_64
compiler info: gnuc: 13.2
libc info: glibc: 2.38
$SHELL (typically, interactive shell): /usr/bin/fish
--
Mit freundlichen Grüßen / kind regards
*Jasmin Oster*
Software Developer
ANEXIA Internetdienstleistungs GmbH
E-Mail: JOster@anexia.com <mailto:DName@anexia.com>
Web: anexia.com <https://anexia.com/>
Anschrift Hauptsitz Klagenfurt: Feldkirchner Straße 140, 9020 Klagenfurt
Geschäftsführer: Alexander Windbichler
Firmenbuch: FN 289918a | Gerichtsstand: Klagenfurt | UID-Nummer: AT
U63216601
next reply other threads:[~2024-04-03 13:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 13:26 Jasmin Oster [this message]
2024-04-03 17:29 ` git-merge: --no-commit is not respected on a fresh repository 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=22efe19e-de44-4b6d-8e8b-57e2bddb321e@anexia.com \
--to=joster@anexia.com \
--cc=git@vger.kernel.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 read-only IMAP folder(s) and NNTP newsgroup(s).