Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sha1_name: compare variable with constant, not constant with variable
author
Felipe Contreras
<felipe.contreras@gmail.com>
Tue, 30 Apr 2013 21:49:11 +0000
(16:49 -0500)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 8 May 2013 19:13:12 +0000
(12:13 -0700)
And restructure the if/else to factor out the common "is len positive?"
test into a single conditional.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
cdfd948
)
diff --git
a/sha1_name.c
b/sha1_name.c
index 4428df19a7d3fff7c5d4a403f1677b694170129f..5a58720d85be0af90a32490e31831df5bc7f1ae8 100644
(file)
--- a/
sha1_name.c
+++ b/
sha1_name.c
@@
-1033,12
+1033,14
@@
int interpret_branch_name(const char *name, struct strbuf *buf)
int len = interpret_nth_prior_checkout(name, buf);
int tmp_len;
- if (!len)
+ if (!len)
{
return len; /* syntax Ok, not enough switches */
- if (0 < len && len == namelen)
- return len; /* consumed all */
- else if (0 < len)
- return reinterpret(name, namelen, len, buf);
+ } else if (len > 0) {
+ if (len == namelen)
+ return len; /* consumed all */
+ else
+ return reinterpret(name, namelen, len, buf);
+ }
cp = strchr(name, '@');
if (!cp)