-6

The question is How do I manipulate (dump and load) Git index as text?:

Is there a pair of Git commands that would allow to

  • dump current contents of Git index to stdout as text in some format (one entry per line, including full path to the file);
  • read text in the above format from stdin into Git index, fully replacing its current contents?

The answer is https://stackoverflow.com/a/53722759/857932 (emphasis mine):

Using git ls-files --stage and git update-index --index-info can get you all the way there, though it's a bit clumsy in spots: removing a file means setting its mode to zero, and renaming a file amounts to duplicate the line <...>

Now this answer does not fully answer the question: it does not address the "fully replacing its current contents?" part, instead suggesting an inconvenient workaround.

I found a way to improve on the answer to address the missing part, and proposed it as an edit: https://stackoverflow.com/review/suggested-edits/21656371

The edit was rejected:

This edit was intended to address the author of the post and makes no sense as an edit. It should have been written as a comment or an answer.

I do not understand this rejection reason. It clearly addresses the original question and the asker (i. e. me), not the answerer. How should I have achieved my intention?


Should I have posted my improvement as a separate answer instead? It feels wrong: I cannot accept the answerer's answer as-is (because it does not fully answer my question) and I cannot accept my own answer, because this won't give the answerer due credit (it was their idea, after all, and only an improvement that is mine).

17
  • Wait for a while until torek goes online. He can then accept your edit.
    – Braiam
    Commented Dec 11, 2018 at 15:16
  • @Braiam I guess the jury's already done on this edit, and the verdict is "Reject". Can the original author overturn the community's decision?
    – intelfx
    Commented Dec 11, 2018 at 15:17
  • 27
    This edit puts words in the authors mouth and deviates from the original intent. Your edit should have been a comment or a different answer.
    – user4639281
    Commented Dec 11, 2018 at 15:21
  • 12
    Deriving your own answer from an existing post is explicitly encouraged by the SO site license. All you have to do is attribute it correctly, link to the author's profile and a link to his post. Commented Dec 11, 2018 at 15:22
  • @TinyGiant I thought SO was a technical Q&A site, not a collective blog, and it strives to value objective knowledge over preserving authors' words?
    – intelfx
    Commented Dec 11, 2018 at 15:23
  • 1
    No, SO is a wiki. "Stack Overflow ultimately has much more in common with Wikipedia than a discussion forum. By this I mean questions and answers on Stack Overflow are not primarily judged by their usefulness to a specific individual, but by how many other programmers that question or answer can potentially help over time. I tried as hard as I could to emphasize this relationship from launch day in 2008. Note who has top billing in this venn diagram" Ignore everyone that wants to tell you otherwise.
    – Braiam
    Commented Dec 11, 2018 at 15:25
  • @Braiam That's what I intended to say.
    – intelfx
    Commented Dec 11, 2018 at 15:26
  • Source blog.codinghorror.com/…
    – Braiam
    Commented Dec 11, 2018 at 15:26
  • 11
    @intelfx edits must not deviate from the original intent, or put words in the author's mouth. Plain and simple. That doesnt make it a blog, I dont get your reasoning there.
    – user4639281
    Commented Dec 11, 2018 at 15:27
  • 2
    @intelfx You asked why it was rejected. Users are telling you why. But you are arguing against that. It doesn't makes a lot of sense. If you already knew how this feature worked, your edit wouldn't have been rejected.
    – yivi
    Commented Dec 11, 2018 at 15:28
  • 3
    @Braiam Jeff left SO in 2012 and thus isn't an authorative source for anything happening after that... Otherwise we probably wouldn't have the current watered down quality standards.
    – l4mpi
    Commented Dec 11, 2018 at 15:31
  • 3
    @yivi It makes all the sense: I'm not here to blindly accept authority. If I did not want to argue, I would not have come here in the first place. I will keep arguing unless presented with clear reasoning.
    – intelfx
    Commented Dec 11, 2018 at 15:31
  • 4
    @intelfx: I'm interpreting this as a good-faith question in terms of you simply not knowing the policy around here. Thanks for asking about it. Some related reading would be this answer where I explicitly go over what is and isn't acceptable for edits. You can find other references as well.
    – Makoto
    Commented Dec 11, 2018 at 16:20
  • 5
    As a heads-up, I've cleaned up the comments here that were turning into a rather personal back-and-forth, and I didn't see that going in a positive direction. Similarly, I've moved the comments below into chat, which might be the better place to hash out disputes. If you have an answer, please provide one.
    – Brad Larson Mod
    Commented Dec 11, 2018 at 16:45
  • 2
    The choice of comment deletion here has removed any sense of continuity from the discussion.
    – user4639281
    Commented Dec 11, 2018 at 16:50

2 Answers 2

15

Should I have posted my improvement as a separate answer instead?

Yes. If you have come up with a different solution to the problem than another answerer, that you think is better, you should be posting it as your own answer, not editing someone else's answer to use your solution.

I cannot accept the answerer's answer as-is (because it does not fully answer my question) and I cannot accept my own answer, because this won't give the answerer due credit

That's your choice to make. If you want to accept an incomplete answer because you were able to use the information to come up with what you think is a better solution, you can. If you want to accept what you think is the best solution (in this case, the answer you came up with), you can do that to. If you can't decide and don't want to accept any answer, that's also fine.

If you think that an answer was useful, but don't feel that it was the best answer to the question, you can upvote it instead of accepting it.

The other route that you could go down would be to comment on the post to convince the owner of why you feel your approach would be better, so that they change their answer to use the solution you think is best instead. Generally this is better for smaller changes that are not particularly impactful; given your description of the situation it doesn't sound like you think that's the case here, so I'd personally lean towards posting it as a new answer, rather than hoping to convince someone else to edit it in.

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Brad Larson Mod
    Commented Dec 11, 2018 at 16:40
1

Imagine Joe said something like:

Hey guys, Joe here, everyone in my company drinks 2 coffees every day.

Let's say you somehow know there's some flaws in that statement, then here's several ways to correct it:

Option A: You put on Joe's mask and state to everyone again:

Hey guys, Joe again, actually everyone in my company drinks 2 coffees every day, except Sam, who drinks beers instead.

Option B: You tell Joe in a separate conversation:

Hey Joe, isn't Sam only drinking beers every day?

Option C: You simply state (as yourself):

Hey guys, actually there might be an exception in Joe's company; Sam only drinks beers every day.

I admit it's quite a subtle comparison, yet, in everyday life we would rather avoid putting words into other peoples' mouths unless they themselves approve it. Option B and C seem to be better choices even assuming you are right about the correction.

Now just imagine another case:

Joe: Actually Sam is only visiting from a third-party company, so he really doesn't count.

In this case, methods B and C can avoid conflict, or at least put the responsibility of correction on yourself instead of Joe, yet method A left the responsibility of the correction with Joe, which he doesn't deserve.

So, as long as SO is working in a way that associates content and its responsibility (votes, closure, moderation activity) to individual users, method A is usually not a suggested approach. There have been debates about the way SO is currently working for years; I think it's fair to leave that to other threads.

17
  • 1
    "unless they themselves approves so", authors can unilaterally accept or reject edits even after reviewers review. So, what's the problem with an editor suggesting to the author how to improve the information it delivers?
    – Braiam
    Commented Dec 11, 2018 at 16:56
  • This reads like a contrived example. I'm not 100% clear what your answer is adding that isn't already covered in a previous answer.
    – Makoto
    Commented Dec 11, 2018 at 16:57
  • @Makoto he's trying to argue that we shouldn't put words in the author mouth without their authorization, but instead comment or answers themselves. And at the same time, while it tries to explain the subtleties of his everyday conversations, it then ignores the subtleties of stack overflow.
    – Braiam
    Commented Dec 11, 2018 at 17:01
  • @Braiam it's basically about the burden of activity. This edit get into edit review queue, and if approved, the answer will be changed, and the origin answer poster bare the burden of roll it back (if it's wrong), which again, even it's nice for him to do so, he shouldn't be obligated to do anything to avoid someone else putting words into his mouth.
    – tweray
    Commented Dec 11, 2018 at 17:04
  • 2
    ...which is why I'm not seeing why this answer covers any new ground that hasn't already been expounded upon in a previous answer.
    – Makoto
    Commented Dec 11, 2018 at 17:05
  • "it's basically about the burden of activity" again, you are ignoring SO subtleties. Imagine that there wasn't review queue. Only the author needs to review the edits. Would you prevent this edit from being made?
    – Braiam
    Commented Dec 11, 2018 at 17:12
  • 2
    @Braiam As long as the post wasn't changed before the origin OP's approval. Which again, is hard (impossible?) to achieve. Anyone with 2k+ rep will have their edit applied right away, yet lower rep users have to went through the edit review, which in most case will response faster than OP. That's how the system works nowadays. I am in no interest discussing about if this system is good or not here but feel free to create a new meta post. But with the current system in place, the kind of edit that the OP of this meta thread should be discouraged.
    – tweray
    Commented Dec 11, 2018 at 17:20
  • Is not hard to click skip.
    – Braiam
    Commented Dec 11, 2018 at 18:37
  • 2
    @Braiam wait, now you're suggesting that all suggested edit reviewers should skip all edits to posts they are not the author of? WAT?
    – user4639281
    Commented Dec 11, 2018 at 18:46
  • @TinyGiant can you accurately evaluate the cost-benefit of a nuclear plant on Africa? Considering the information we know about you, I would say no. Then why are you so bend in offering your opinion either way?
    – Braiam
    Commented Dec 11, 2018 at 19:37
  • 4
    @Braiam What does any of this have to do with evaluating the cost-benefit of a nuclear power plant on Africa? Seriously now.
    – user4639281
    Commented Dec 11, 2018 at 20:01
  • @TinyGiant that the same way you shouldn't hinder the plans for a nuclear plant, you shouldn't review posts that you don't know anything about.
    – Braiam
    Commented Dec 11, 2018 at 20:05
  • 2
    @Braiam but that's not what we're talking about. We're talking about a post whose intent is very clear and an edit that very clearly changes the intent of said post. I fail to see how your argument applies. This isn't something that requires domain knowledge to evaluate. It is plain and clear that this edit deviates from the original intent regardless of domain knowledge.
    – user4639281
    Commented Dec 11, 2018 at 20:08
  • 1
    @Braiam I doubt that deviating from the original intent of the post / putting words in the authors mouth is allowed anywhere on The Network. But as I've said elsewhere, I cannot speak to the rest of The Network because I'm only active on and familiar with Stack Overflow. Suffice it to say that just because something is a certain way on another site in The Network, doesn't mean it is or should be that way here.
    – user4639281
    Commented Dec 12, 2018 at 0:16
  • 2
    @Braiam Again you're misrepresenting the words of others to mean things they don't mean. Gilles is talking about users who reject every edit they see that changes code regardless of the actual change, instead of reviewing each on a case by case basis. Nowhere does he say that it is OK to edit your own original solution into someone else's answer, nor does he say it is OK to deviate from the original intent of the answer.
    – user4639281
    Commented Dec 12, 2018 at 0:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .