Re: [PATCH/RFC 2/7] refs: report ref type from lock_any_ref_for_update

2013-08-29 Thread Brad King
On 08/29/2013 01:22 PM, Junio C Hamano wrote:
> If you are passing an NULL as a new parameter, please spell it
> "NULL", not "0".

Fixed at all updated call sites.

-Brad
--
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/RFC 2/7] refs: report ref type from lock_any_ref_for_update

2013-08-29 Thread Junio C Hamano
Brad King  writes:

> Expose lock_ref_sha1_basic's type_p argument to callers of
> lock_any_ref_for_update.  Update all call sites to ignore it; we will
> use it later.
> ...
> diff --git a/branch.c b/branch.c
> index c5c6984..c244483 100644
> --- a/branch.c
> +++ b/branch.c
> @@ -291,7 +291,7 @@ void create_branch(const char *head,
>   hashcpy(sha1, commit->object.sha1);
>  
>   if (!dont_change_ref) {
> - lock = lock_any_ref_for_update(ref.buf, NULL, 0);
> + lock = lock_any_ref_for_update(ref.buf, NULL, 0, 0);

If you are passing an NULL as a new parameter, please spell it
"NULL", not "0".

--
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/RFC 2/7] refs: report ref type from lock_any_ref_for_update

2013-08-29 Thread Brad King
Expose lock_ref_sha1_basic's type_p argument to callers of
lock_any_ref_for_update.  Update all call sites to ignore it; we will
use it later.

Signed-off-by: Brad King 
---
 branch.c   |2 +-
 builtin/commit.c   |2 +-
 builtin/fetch.c|2 +-
 builtin/receive-pack.c |2 +-
 builtin/reflog.c   |2 +-
 builtin/replace.c  |2 +-
 builtin/tag.c  |2 +-
 fast-import.c  |2 +-
 refs.c |7 ---
 refs.h |2 +-
 sequencer.c|2 +-
 11 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/branch.c b/branch.c
index c5c6984..c244483 100644
--- a/branch.c
+++ b/branch.c
@@ -291,7 +291,7 @@ void create_branch(const char *head,
hashcpy(sha1, commit->object.sha1);
 
if (!dont_change_ref) {
-   lock = lock_any_ref_for_update(ref.buf, NULL, 0);
+   lock = lock_any_ref_for_update(ref.buf, NULL, 0, 0);
if (!lock)
die_errno(_("Failed to lock ref for update"));
}
diff --git a/builtin/commit.c b/builtin/commit.c
index 10acc53..78d773f 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1618,7 +1618,7 @@ int cmd_commit(int argc, const char **argv, const char 
*prefix)
   !current_head
   ? NULL
   : current_head->object.sha1,
-  0);
+  0, 0);
 
nl = strchr(sb.buf, '\n');
if (nl)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index d784b2e..34903ef 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -246,7 +246,7 @@ static int s_update_ref(const char *action,
rla = default_rla.buf;
snprintf(msg, sizeof(msg), "%s: %s", rla, action);
lock = lock_any_ref_for_update(ref->name,
-  check_old ? ref->old_sha1 : NULL, 0);
+  check_old ? ref->old_sha1 : NULL, 0, 0);
if (!lock)
return errno == ENOTDIR ? STORE_REF_ERROR_DF_CONFLICT :
  STORE_REF_ERROR_OTHER;
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index e3eb5fc..dd61234 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -524,7 +524,7 @@ static const char *update(struct command *cmd)
return NULL; /* good */
}
else {
-   lock = lock_any_ref_for_update(namespaced_name, old_sha1, 0);
+   lock = lock_any_ref_for_update(namespaced_name, old_sha1, 0, 0);
if (!lock) {
rp_error("failed to lock %s", name);
return "failed to lock";
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 54184b3..11b30f9 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -366,7 +366,7 @@ static int expire_reflog(const char *ref, const unsigned 
char *sha1, int unused,
 * we take the lock for the ref itself to prevent it from
 * getting updated.
 */
-   lock = lock_any_ref_for_update(ref, sha1, 0);
+   lock = lock_any_ref_for_update(ref, sha1, 0, 0);
if (!lock)
return error("cannot lock ref '%s'", ref);
log_file = git_pathdup("logs/%s", ref);
diff --git a/builtin/replace.c b/builtin/replace.c
index 59d3115..e2e2002 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -105,7 +105,7 @@ static int replace_object(const char *object_ref, const 
char *replace_ref,
else if (!force)
die("replace ref '%s' already exists", ref);
 
-   lock = lock_any_ref_for_update(ref, prev, 0);
+   lock = lock_any_ref_for_update(ref, prev, 0, 0);
if (!lock)
die("%s: cannot lock the ref", ref);
if (write_ref_sha1(lock, repl, NULL) < 0)
diff --git a/builtin/tag.c b/builtin/tag.c
index af3af3f..c261469 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -577,7 +577,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
if (annotate)
create_tag(object, tag, &buf, &opt, prev, object);
 
-   lock = lock_any_ref_for_update(ref.buf, prev, 0);
+   lock = lock_any_ref_for_update(ref.buf, prev, 0, 0);
if (!lock)
die(_("%s: cannot lock the ref"), ref.buf);
if (write_ref_sha1(lock, object, NULL) < 0)
diff --git a/fast-import.c b/fast-import.c
index 23f625f..5f7ef82 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1678,7 +1678,7 @@ static int update_branch(struct branch *b)
return 0;
if (read_ref(b->name, old_sha1))
hashclr(old_sha1);
-   lock = lock_any_ref_for_update(b->name, old_sha1, 0);
+   lock = lock_any_ref_for_update(b->name, old_sha1, 0, 0);
if (!lock)
return error("Unable to lock %s", b->name);
if (!force