You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/01 11:05:54 UTC

[18/49] chttpd commit: updated refs/heads/windsor-merge to 554ef74

Remove unnecessary pattern match and associated extraneous _rev check

The pattern match breaks when users submit _bulk_docs requests of the
format:

    {"docs": [[{"_id": "foo"}]]}

couch_doc:from_json_obj/1 already performs the appropriate _rev logic,
so that check is unnecessary.

BugzID: 21746


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/440f5a0f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/440f5a0f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/440f5a0f

Branch: refs/heads/windsor-merge
Commit: 440f5a0ffedded1d33ba382810c7145c881d1f55
Parents: e6d115a
Author: Benjamin Anderson <b...@banjiewen.net>
Authored: Fri Aug 16 15:07:25 2013 -0700
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 29 18:06:18 2014 +0100

----------------------------------------------------------------------
 src/chttpd_db.erl | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/440f5a0f/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index c81bf85..57b0c4f 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -320,21 +320,14 @@ db_req(#httpd{method='POST',path_parts=[_,<<"_bulk_docs">>], user_ctx=Ctx}=Req,
     case couch_util:get_value(<<"new_edits">>, JsonProps, true) of
     true ->
         Docs = lists:map(
-            fun({ObjProps} = JsonObj) ->
+            fun(JsonObj) ->
                 Doc = couch_doc:from_json_obj(JsonObj),
                 validate_attachment_names(Doc),
                 Id = case Doc#doc.id of
                     <<>> -> couch_uuids:new();
                     Id0 -> Id0
                 end,
-                case couch_util:get_value(<<"_rev">>, ObjProps) of
-                undefined ->
-                    Revs = {0, []};
-                Rev  ->
-                    {Pos, RevId} = couch_doc:parse_rev(Rev),
-                    Revs = {Pos, [RevId]}
-                end,
-                Doc#doc{id=Id,revs=Revs}
+                Doc#doc{id=Id}
             end,
             DocsArray),
         Options2 =