Git Product home page Git Product logo

Comments (5)

b4nst avatar b4nst commented on July 25, 2024

Hi, thanks for reporting. I'm not sure about the behavior here. Doesn't adding a carriage return would break the Commit message with no body? I want to keep the git commit default behavior and I though it was to let the CR/LF to the hooks/tools?
I may be totally wrong here, in that case this should be a quick fix but I want to be sure about it first.

Whatever the decision, I will at least add an option (tug options are managed through git) to add this CR/LF automatically since it seems to be useful to at least you.

from turbogit.

talios avatar talios commented on July 25, 2024

A quick test using the standard git -m command for a "commit message with no body" including a signoff gives a blank line between the summary and body (my understanding of the git commit format - much like SMTP headers): summary, blank line, body, blank line, trailers.

/t/testing on  master [+] ❯ git commit -a -m "Test" -s
[master (root-commit) d100763] Test
 1 file changed, 2 insertions(+)
 create mode 100644 test.txt
/t/testing on  master ❯ git log
commit d10076354de294a79c2114e2a5f5aa5399aefdc5 (HEAD -> master)
Author: Mark Derricutt <[email protected]>
Date:   Thu Jan 28 20:03:16 2021 +1300

    Test

    Signed-off-by: Mark Derricutt <[email protected]>

Interesting - reading the docs for git-interpret-trailers at http://manpages.ubuntu.com/manpages/cosmic/man1/git-interpret-trailers.1.html :

By default the new trailer will appear at the end of all the existing trailers. If there is no existing trailer, the new trailer will appear after the commit message part of the output, and, if there is no line with only spaces at the end of the commit message part, one blank line will be added before the new trailer.

From this one could argue that it's up to the hook script from Gerrit to add that blank line - but it appears that tug's behaviour is different to git.

from turbogit.

talios avatar talios commented on July 25, 2024

Interesting - using tug against most of our projects repositories - some which use a newer version of Gerrit's commit hook, I see that my Change-Id trailers seen to get added correctly with a blank line ( the hook adds it ).

So this may not be required if I just update my hooks - tho it may be useful to have regardless.

from turbogit.

b4nst avatar b4nst commented on July 25, 2024

In your test you used -s option. In my understanding the blank line is added with the -s option, not after the subject. That can be reproduced with multiple -m options:

➜  git commit --allow-empty -m "First line" -m "Second line" -m "Third line"
[master fa47988] First line
➜  git log
commit fa479888ea93683f35ac8e7edb2c99920c814c30 (HEAD -> master)
Author: foo <[email protected]>
Date:   Sat Jan 30 11:03:27 2021 +0100

    First line

    Second line

    Third line

But I think tug commit build -s bug-1234 Updated dependencies should reproduce git commit --allow-empty -m "build(bug-1234): Updated dependencies" which it actually does:

commit 6f11f475ef53347b57474abce680476780034644 (HEAD -> master)  <---- turbogit
Author: foo <[email protected]>
Date:   Sat Jan 30 11:11:04 2021 +0100

    build(bug-1234): Updated dependencies

commit db5856c9696c224bf1ebaa507675653a413715e8                   <---- git commit
Author: foo <[email protected]>
Date:   Sat Jan 30 11:09:06 2021 +0100

    build(bug-1234): Updated dependencies

Do you agree with that?

from turbogit.

b4nst avatar b4nst commented on July 25, 2024

Closing since I think it's the expected behavior.

from turbogit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.