@@ -831,7 +831,39 @@ extern int get_sha1_hex(const char *hex, unsigned char *sha1);
831
831
832
832
extern char * sha1_to_hex (const unsigned char * sha1 ); /* static buffer result! */
833
833
extern int read_ref (const char * filename , unsigned char * sha1 );
834
- extern const char * resolve_ref (const char * path , unsigned char * sha1 , int , int * );
834
+
835
+ /*
836
+ * Resolve a reference, recursively following symbolic refererences.
837
+ *
838
+ * Store the referred-to object's name in sha1 and return the name of
839
+ * the non-symbolic reference that ultimately pointed at it. The
840
+ * return value, if not NULL, is a pointer into either a static buffer
841
+ * or the input ref.
842
+ *
843
+ * If the reference cannot be resolved to an object, the behavior
844
+ * depends on the "reading" argument:
845
+ *
846
+ * - If reading is set, return NULL.
847
+ *
848
+ * - If reading is not set, clear sha1 and return the name of the last
849
+ * reference name in the chain, which will either be a non-symbolic
850
+ * reference or an undefined reference. If this is a prelude to
851
+ * "writing" to the ref, the return value is the name of the ref
852
+ * that will actually be created or changed.
853
+ *
854
+ * If flag is non-NULL, set the value that it points to the
855
+ * combination of REF_ISPACKED (if the reference was found among the
856
+ * packed references) and REF_ISSYMREF (if the initial reference was a
857
+ * symbolic reference).
858
+ *
859
+ * If ref is not a properly-formatted, normalized reference, return
860
+ * NULL. If more than MAXDEPTH recursive symbolic lookups are needed,
861
+ * give up and return NULL.
862
+ *
863
+ * errno is sometimes set on errors, but not always.
864
+ */
865
+ extern const char * resolve_ref (const char * ref , unsigned char * sha1 , int reading , int * flag );
866
+
835
867
extern int dwim_ref (const char * str , int len , unsigned char * sha1 , char * * ref );
836
868
extern int dwim_log (const char * str , int len , unsigned char * sha1 , char * * ref );
837
869
extern int interpret_branch_name (const char * str , struct strbuf * );
0 commit comments