Re: [PATCH 6/7] sha1_name: prepare to introduce AT_KIND_PUSH

2013-05-24 Thread Ramkumar Ramachandra
Felipe Contreras wrote:
>   git push branch@{push}
>
> Is not clear at all: push push of branch?

We can pick the name later.  I had to pick a name to write code, and
that happens to be @{push}.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/7] sha1_name: prepare to introduce AT_KIND_PUSH

2013-05-24 Thread Felipe Contreras
On Thu, May 23, 2013 at 10:12 AM, Ramkumar Ramachandra
 wrote:
> Introduce an AT_KIND_PUSH to be represented as "@{p[ush]}".  Determine
> it using branch.remote.push_refspec.

I think the semantics of this don't make any sense.

  git push branch@{upstream}

Is very clear: push upstream of branch.

  git push branch@{push}

Is not clear at all: push push of branch?

Is it a noun, or a verb?

I would expect branch@{X} to be 'the X of branch', and "the push of
branch" doesn't make sense. Whatever X ends up being, it should be a
noun.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] sha1_name: prepare to introduce AT_KIND_PUSH

2013-05-23 Thread Ramkumar Ramachandra
Introduce an AT_KIND_PUSH to be represented as "@{p[ush]}".  Determine
it using branch.remote.push_refspec.

Signed-off-by: Ramkumar Ramachandra 
---
 sha1_name.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index 106716e..5f6958b 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -23,7 +23,7 @@ struct disambiguate_state {
unsigned always_call_fn:1;
 };
 
-#define AT_KIND_UPSTREAM 0
+enum at_kind { AT_KIND_UPSTREAM, AT_KIND_PUSH };
 
 static void update_candidates(struct disambiguate_state *ds, const unsigned 
char *current)
 {
@@ -426,7 +426,8 @@ static inline int at_mark(const char *string, int len, int 
*kind)
int kind;
const char *suffix[2];
} at_form[] = {
-   { AT_KIND_UPSTREAM, { "@{upstream}", "@{u}" } }
+   { AT_KIND_UPSTREAM, { "@{upstream}", "@{u}" } },
+   { AT_KIND_PUSH, { "@{push}", "@{p}" } }
};
 
for (j = 0; j < ARRAY_SIZE(at_form); j++) {
@@ -1022,6 +1023,12 @@ static void die_no_upstream(struct branch *upstream, 
char *name) {
  *   given buf and returns the number of characters parsed if
  *   successful.
  *
+ * - "@{push}" finds the name of the ref that
+ *is configured to push to (missing  defaults
+ *   to the current branch), and places the name of the branch in the
+ *   given buf and returns the number of characters parsed if
+ *   successful.
+ *
  * If the input is not of the accepted format, it returns a negative
  * number to signal an error.
  *
@@ -1077,6 +1084,8 @@ int interpret_branch_name(const char *name, struct strbuf 
*buf)
free(cp);
cp = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
break;
+   case AT_KIND_PUSH:
+   break;
}
 
strbuf_reset(buf);
-- 
1.8.3.rc3.17.gd95ec6c.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html