[GSoC][PATCH v4 3/4] submodule: port set_name_rev() from shell to C
- From
Han-Wen Nienhuys <hanwen@google.com>
- Date
- Sep 21, 2017, 15:31 UTC
- Message-ID
- <20170921153155.8544-1-hanwen@google.com>
- In-Reply-To
- <20170828115558.28297-4-pc44800@gmail.com>
LGTM with nits
commit message:
"revision name, and later handles its formating and printing."
typo: formatting
+ if (!capture_command(&cp, &sb, 0) && sb.len) { + strbuf_strip_suffix(&sb, "\n"); + return strbuf_detach(&sb, NULL); + }
you discard all output if these commands fail, so if the argument is a not a submodule, or the other is not a sha1, it will just print nothing without error message. Maybe that is OK, though? I don't see documentation for these commands, so maybe this is not meant to be usable?