git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] hg-to-git: handle an empty dir in hg by combining git commits

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 5, 2007, 07:01 UTC
Message-ID
<7veje11v7f.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7vd4tq41zt.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> Mark Drago <markdrago@gmail.com> writes:
>
>> This patch will detect that there are no changes to commit (using git-status),
>> and will not perform the commit, but will instead combine the log messages of
>> that (non-)commit with the next commit.
>
> I think a better approach would be to implement --no-tree-change-is-ok
> option to git-commit, strictly for use by foreign scm interface scripts
> like yours.  It does not usually make sense to record a commit that has
> the exact same tree as its sole parent commit and that is why git-commit
> prevents you from making that mistake, but when data from foreign scm is
> involved, it is a different story.  We are equipped to represent such a
> (perhaps insane, perhaps by mistake, or perhaps done on purpose) change
> and it is better to represent it bypassing the safety valve for native
> use.

So I did "git commit --allow-empty". With that, perhaps the following will fix the issue?

I won't be commiting this myself until I hear a positive Ack.
---
 contrib/hg-to-git/hg-to-git.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index 7a1c3e4..9befb92 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -211,7 +211,7 @@ for cset in range(int(tip) + 1):
     os.system('git-ls-files -x .hg --deleted | git-update-index --remove --stdin')
 
     # commit
-    os.system(getgitenv(user, date) + 'git-commit -a -F %s' % filecomment)
+    os.system(getgitenv(user, date) + 'git commit --allow-empty -a -F %s' % filecomment)
     os.unlink(filecomment)
 
     # tag
Previous: Junio C HamanoNext: Mark Drago
Message 7 of 8 in “hg-to-git: handle an empty dir in hg by combining git commits”
  1. hg-to-git: handle an empty dir in hg by combining git commitsMark Drago, Dec 1, 2007
  2. Junio C HamanoDec 1, 2007
  3. git-commit --allow-emptyJunio C Hamano, Dec 3, 2007
  4. git-commit --allow-emptyJunio C Hamano, Dec 3, 2007
  5. Nicolas PitreDec 3, 2007
  6. Junio C HamanoDec 3, 2007
  7. Junio C HamanoDec 5, 2007
  8. Mark DragoDec 6, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.