Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce git_describe_xxxx() #1066

Closed
wants to merge 4 commits into from
Closed

Introduce git_describe_xxxx() #1066

wants to merge 4 commits into from

Conversation

nulltoken
Copy link
Member

  • git_describe_objects()
  • git_describe_objects() tests
  • git_describe_workdir()
  • git_describe_workdir() tests
  • API documentation
  • Either remove abbreviated_size from git_describe_opts or implement it

@ben
Copy link
Member

ben commented Nov 13, 2012

You can probably 🔨 all of the test-repo files except for refs, objects, and HEAD. We don't need the sample hooks. 😉

git_describe_opts *opts;
};

int get_name (const char *refname, void *payload)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be made static?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@nulltoken
Copy link
Member Author

You can probably 🔨 all of the test-repo files except for refs, objects, and HEAD. We don't need the sample hooks. 😉

I've cleaned the test repo as much as possible. However, I've kept the logs and the index. I may remove them when I'm completely done with this feature if I don't rely on them.

@nulltoken
Copy link
Member Author

@ben thanks for this very early feedback! 😉

@ben
Copy link
Member

ben commented Nov 13, 2012

No problem. I like where you're going with this. 🚆

@nulltoken
Copy link
Member Author

Rebooted!

@nulltoken
Copy link
Member Author

ZOMG! Passing tests!

GIT_DESCRIBE_DEFAULT,
GIT_DESCRIBE_TAGS,
GIT_DESCRIBE_ALL,
} git_describe_strategy_t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values could use a bit of documentation.

@ben
Copy link
Member

ben commented Sep 30, 2013

So far so good! I see you've still got lots of TODOs in the code, so I'll stop here, but I like where this is going.

Built with the following script:

	#!/bin/sh

	test_tick () {
		sleep 10
	}

	test_tick &&
	echo one >file && git add file && git commit -m initial &&
	one=$(git rev-parse HEAD) &&

	git describe --always HEAD &&

	test_tick &&
	echo two >file && git add file && git commit -m second &&
	two=$(git rev-parse HEAD) &&

	test_tick &&
	echo three >file && git add file && git commit -m third &&

	test_tick &&
	echo A >file && git add file && git commit -m A &&
	test_tick &&
	git tag -a -m A A &&

	test_tick &&
	echo c >file && git add file && git commit -m c &&
	test_tick &&
	git tag c &&

	git reset --hard $two &&
	test_tick &&
	echo B >side && git add side && git commit -m B &&
	test_tick &&
	git tag -a -m B B &&

	test_tick &&
	git merge -m Merged c &&
	merged=$(git rev-parse HEAD) &&

	git reset --hard $two &&
	test_tick &&
	echo D >another && git add another && git commit -m D &&
	test_tick &&
	git tag -a -m D D &&
	test_tick &&
	git tag -a -m R R &&

	test_tick &&
	echo DD >another && git commit -a -m another &&

	test_tick &&
	git tag e &&

	test_tick &&
	echo DDD >another && git commit -a -m "yet another" &&

	test_tick &&
	git merge -m Merged $merged &&

	test_tick &&
	echo X >file && echo X >side && git add file side &&
	git commit -m x
@yura-yaroshevich
Copy link

Hi, is there any progress since January on implementation of git describe? Thanks.

@rafecolton
Copy link

+1 on desiring this feature fwiw

@carlosmn
Copy link
Member

I've started to take a look at this, hopefully there'll be something to share soon. I think that I'm going to separate the API into two distinct bits, one which searches for the matching name, and one which prints it.

The current code is very much git-like in that it prints from the middle of the function which is gathering data. I'd like to see us have git_describe_{commit,workdir}() which gather the data and a git_describe_format() which knows how to print the data. This also lets us separate the option structs into options for finding what we want, and those for displaying what we found.

@carlosmn carlosmn mentioned this pull request Sep 30, 2014
8 tasks
@nulltoken
Copy link
Member Author

superseded by #2592

@nulltoken nulltoken closed this Sep 30, 2014
@nulltoken nulltoken deleted the topic/describe branch September 30, 2014 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants