Skip to content

Commit

Permalink
magit-get: don't return only first line of value
Browse files Browse the repository at this point in the history
Fixes #2719
Re #2720.
  • Loading branch information
tarsius committed Aug 5, 2016
1 parent fbf0774 commit 11e1478
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lisp/magit-git.el
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ Return a list of two integers: (A>B B>A)."

(defun magit-get (&rest keys)
"Return the value of Git config entry specified by KEYS."
(magit-git-str "config" (mapconcat 'identity keys ".")))
(car (apply 'magit-git-all keys)))

(defun magit-get-all (&rest keys)
"Return all values of the Git config entry specified by KEYS."
Expand Down

3 comments on commit 11e1478

@aaa70
Copy link
Contributor

@aaa70 aaa70 commented on 11e1478 Aug 15, 2016

Choose a reason for hiding this comment

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

Hi,

I'm using "magit-insert-user-header".
This change returns global setting like this:

(magit-git-str "config" (mapconcat 'identity '("user.email") ".")) ; => local@setting.com
(car (apply 'magit-get-all '("user.email"))) ; => global@setting.com

So I guess that is correct.

(car (last (apply 'magit-get-all '("user.email"))))

What do you think?

Thanks,

@tarsius
Copy link
Member Author

Choose a reason for hiding this comment

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

Yikes. No, that's not the expected behavior. Thanks for noticing. I have reverted the change for now. We have to do this more carefully the next time around!

@aaa70
Copy link
Contributor

@aaa70 aaa70 commented on 11e1478 Aug 16, 2016

Choose a reason for hiding this comment

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

Hi tarsius,
I see. But thank you for reverting!

Please sign in to comment.