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

Git question rewarding git merge and its exit codes

From
IEIván Expósito <byjokese@gmail.com>
Date
Jun 26, 2023, 12:14 UTC
Message-ID
<CAPDGPD5UK8+Z0ksX-tv2Rs8ESZ+LCY-Tic-dZSGV0QNStFN=Pg@mail.gmail.com>
Hi, my name is Ivan.

Recently, we have been working on some automations for Git, especially auto-merging some branches. Just noticed that when using: git merge --commit --no-ff -m "test message", and no changes are needed, git returns "Already up-to-date" with exit code 0. Is this correct? Git hasn't done anything, so not sure how correct is to return 0 for success when nothing has been done. We have here a problem because the only way we can detect if a commit has been made or not is to check the return text, which is not the best idea for future-proof, or changes in the return text.

Is this exit code as defined, or maybe is something we would need to look into for future improvements? Is there any other alternatives to detect what has happened, not comparing the standard output text?

Thanks for your work, If any information is needed, don't hesitate to contact me.

Thanks, Ivan

Next: rsbecker@nexbridge.com
Message 1 of 3 in “Git question rewarding git merge and its exit codes”
  1. Iván ExpósitoJun 26, 2023
  2. rsbecker@nexbridge.comJun 26, 2023
  3. Iván ExpósitoJun 26, 2023

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.